saveToArchive

abstract suspend fun saveToArchive(blocks: List<DesignBlock>): ByteBuffer

Saves the given blocks to an archive. Note: All given block handles must be valid, otherwise this call returns an error.

Performs an internal update to lay out pending changes before the save.

While a font loads, its text is laid out with another font. When the text's size follows its content, blocks archived before the font arrives can differ from blocks archived after it. To compare two archives, first call engine.block.forceLoadResources(blocks), then compare the blocks.blocks files inside them. Each archive entry stores the time of the save.

A page slice has no children, so the blocks that it owns on its page are archived as its children. A page slice on a page among blocks makes the update run also while features/implicitUpdatesEnabled is off. A block among blocks is archived once, as a block of its own. A block that a page slice owns is saved with its Percent position and size in design units. The copy does not follow the size of its page.

Cancelling the coroutine stops the save.

Return

the archive in zip format. From Android 9 a buffer of 1 MiB or more is a direct buffer over a temp file of the engine, without a copy and without a backing array: read it with get, not array. The file goes once the buffer and every view of it are collected.

Parameters

blocks

the blocks to save.